package com.klun.concDesign.chapterFive.NIO;

import java.io.IOException;

public class NioTest {
    public static void main(String[] args) {

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                MultiThreadServer server = new MultiThreadServer();
                try {
                    server.startServer();

                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                MultiThreadClient client = new MultiThreadClient();

                try {
                    client.init("192.168.24.1",8765);
                    client.working();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });

        t1.start();
        t2.start();
        try {
            Thread.sleep(30000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
